import api from '@/http/index'

/* 列表 */
export const getTablesList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Shop/GetGridJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
// 门店用户
export const getUserTablesList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ShopUser/ShopUserList', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 新建 */
export const addTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/Shop/SubmitForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 新建门店用户 */
export const addUserTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/ShopUser/CreateShopUser', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 新建科室珍室 */
export const addAllDepartTablesItem = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/ShopDepartment/SubmitForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 删除科室珍室 */
export const deleteAllDepart = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/ShopDepartment/DeleteForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 根据id获取 */
export const getItemInfo = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Shop/GetFormJson', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 根据id获取user */
export const getUserItemInfo = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ShopUser/GetForm', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 禁用启用开关 */
export const loginSwitch = (data) => {
    return new Promise((resolve, reject) => {
        api.post('/api/ShopUser/LoginSwitch', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 选择科室 */
export const getAllDepart = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ShopDepartment/AllDepart', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 门店所有科室及诊室 */
export const getAllDepartTablesList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ShopDepartment/AllDepart', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

/* 选择珍室 */
export const getClinicList = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/ShopDepartment/ClinicList', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};
/* 根据id获取 */
export const setDisableEnable = (data) => {
    return new Promise((resolve, reject) => {
        api.get('/api/Shop/StateControl', data).then((res) => {
            resolve(res);
        }).catch(err => {
            reject(err)
        })
    });
};

